package com.example.recordingpen_datacollection.Utils.VerifyUtil;

import com.example.recordingpen_datacollection.Utils.DateUtils.TimeJudgeUtils;

import java.util.HashMap;
import java.util.Map;

public class StrVerify {
    public static Map<String,Object> conferenceInformation(String str){
        //时间段
        String beginDate = null;
        String endDate = null;
        boolean fale = false;
        if(!str.contains("会议")){
            System.out.println("第零部分");
            System.out.println("开始时间 "+beginDate);
            System.out.println("结束时间 "+endDate);
            System.out.println("fale "+fale);
            Map<String,Object> map = new HashMap<>();
            map.put("beginDate",beginDate);
            map.put("endDate",endDate);
            map.put("fale",fale);
            return map;
        } else {
            fale = true;
        }
        if(str.contains("今天") &&(!str.contains("昨天")&& !str.contains("前天"))){

            beginDate = TimeJudgeUtils.addNowDayTime(0)+" 00:00:00";
            endDate = TimeJudgeUtils.addNowDayTime(0)+" 23:59:59";

        } else if(str.contains("昨天") &&(!str.contains("今天")&& !str.contains("前天")) ) {

            beginDate = TimeJudgeUtils.addNowDayTime(-1)+" 00:00:00";
            endDate = TimeJudgeUtils.addNowDayTime(-1)+" 23:59:59";

        } else if(str.contains("前天") &&(!str.contains("今天")&& !str.contains("昨天")) ) {

            beginDate = TimeJudgeUtils.addNowDayTime(-2)+" 00:00:00";
            endDate = TimeJudgeUtils.addNowDayTime(-2)+" 23:59:59";

        }
        if(beginDate != null && endDate!= null){
            Map<String,Object> map = new HashMap<>();
            map.put("beginDate",beginDate);
            map.put("endDate",endDate);
            map.put("fale",fale);
            return map;
        }

        if( str.contains("今天") && str.contains("昨天") ){

            beginDate = TimeJudgeUtils.addNowDayTime(-1)+" 00:00:00";
            endDate = TimeJudgeUtils.addNowDayTime(0)+" 23:59:59";

        } else if( str.contains("昨天") && str.contains("前天") ){

            beginDate = TimeJudgeUtils.addNowDayTime(-2)+" 00:00:00";
            endDate = TimeJudgeUtils.addNowDayTime(-1)+" 23:59:59";

        } else if(str.contains("今天") && str.contains("前天") ) {

            beginDate = TimeJudgeUtils.addNowDayTime(-2)+" 00:00:00";
            endDate = TimeJudgeUtils.addNowDayTime(0)+" 23:59:59";

        }

        if(beginDate != null && endDate!= null){
            Map<String,Object> map = new HashMap<>();
            map.put("beginDate",beginDate);
            map.put("endDate",endDate);
            map.put("fale",fale);
            return map;
        }
        return null;
    }
}
